package algorithm;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by Administrator on 2017/7/7.
 */
public class PermuteString {
    public void permute(String str){
        char[] str1 = str.toCharArray();
        permute(str1,0,str1.length-1);
    }

    private void permute(char[] str,int low,int high){
        Set<String> compositions = new HashSet<>();
        if (str.length==2){
            compositions.add(String.valueOf(str));
            char[] str1 = {str[1],str[0]};
            compositions.add(String.valueOf(str1));
            System.out.print(compositions);
        }
        else if (str.length>2){
            permute(str,low,high-1);
            System.out.print(",");

        }

    }

    public static void main(String[] args) {

    }
}
